import time
from page.login_page import LoginPage
from selenium.webdriver.common.by import By
class AddPage2(LoginPage):
    # 点击支付管理
    click_payment_loc = (By.XPATH,'//*[@id="sidebar"]/div[2]/div[7]/h2')
    def click_payment(self):
        self.click(self.click_payment_loc)
    # 点击支付产品信息  //*[@id="sidebar"]/div[2]/div[8]/ul/li[1]/div/a
    click_payment2_loc = (By.XPATH, '//*[@id="sidebar"]/div[2]/div[8]/ul/li[1]/div/a')
    def click_payment2(self):
        self.click(self.click_payment2_loc)
    # 点击设置支付方式   //*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[1]
    click_setting_loc = (By.XPATH,'//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[1]')
    def click_setting(self):
        self.click(self.click_setting_loc)
    # 点击设置支付方式     //*[@id="navTab"]/div[2]/div[3]/div[2]/div[1]/ul/li[1]/a/span
    click_setting2_loc = (By.XPATH,'//*[@id="navTab"]/div[2]/div[3]/div[2]/div[1]/ul/li[1]/a/span')
    def click_setting2(self):
        self.click(self.click_setting2_loc)
    # 输入支付费率
    seng_shuru_loc = (By.XPATH,'//*[@id="navTab"]/div[2]/div[4]/div/form/div[1]/div/fieldset/dl[3]/dd/input')
    def seng_shuru(self):
        self.send_keys(self.seng_shuru_loc,'0.3')
    # 点击提交
    submit_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[4]/div/form/div[2]/ul/li[1]/div/div/button')
    def submit(self):
        self.click(self.submit_loc)


    def longguo_add_payment(self):
        self.longguo_login()
        time.sleep(3)
        self.click_payment()
        time.sleep(3)
        self.click_payment2()
        time.sleep(3)
        self.click_setting()
        time.sleep(3)
        self.click_setting2()
        time.sleep(3)
        self.seng_shuru()
        time.sleep(3)
        self.submit()
        time.sleep(3)

